import { Component } from '@angular/core';
import {HttpService} from "./service/http/http.service";
import {Router} from "@angular/router";

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  isCollapsed = false;

  constructor(private http:HttpService,
              private router:Router) {

    let obj = localStorage.getItem("user");
    if (obj){
      this.http.user = JSON.parse(obj);
      this.router.navigateByUrl('/index');
    }else {
      this.router.navigateByUrl('/login');
    }
  }

}
